]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
padOsd: Refactor function setting label after edition into separate function
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 5 Jul 2017 22:03:12 +0000 (00:03 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Fri, 14 Jul 2017 20:20:48 +0000 (22:20 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=782033

js/ui/padOsd.js

index 27dfb6637ff3a3446ebd94b6f371dd879a901ba1..bdc381f9d5d2aea7066b0303741561138fe071aa 100644 (file)
@@ -550,18 +550,22 @@ const PadDiagram = new Lang.Class({
         this.add_actor(label);
     },
 
+    _applyLabel: function(label, action, idx, dir, str) {
+        if (str != null) {
+            label.set_text(str);
+
+            let [found, x, y, arrangement] = this.getLabelCoords(action, idx, dir);
+            this._allocateChild(label, x, y, arrangement);
+        }
+        label.show();
+    },
+
     stopEdition: function (str) {
         this._editorActor.hide();
 
         if (this._curEdited) {
             let [label, action, idx, dir] = this._curEdited;
-            if (str != null) {
-                label.set_text(str);
-
-                let [found, x, y, arrangement] = this.getLabelCoords(action, idx, dir);
-                this._allocateChild(label, x, y, arrangement);
-            }
-            label.show();
+            this._applyLabel(label, action, idx, dir, str);
             this._curEdited = null;
         }
     },